const mrhHttp = require('./mrhhttp.js')
const {
  LMAsyncPostReq,
  baseURL,
  BaseRequestModel,
  LMAsyncUploadReq
} = mrhHttp

const luoAnLogin = "/me/login"; // 登录接口
const luoAnGetUserId = "/user/getuserid"; //获取用户id
const luoAnBnnerList = "/goto/bananalist"; // 获取当前的广告列表
const luoAnDevicePath = "/travelpath/deviceid/query"; // 设备轨迹
const luoAndismissAlarm = "/alarmdetails/relieve/alarm"; //解除警报
const luoAnAlarmQuery = "/alarmdetails/listandfuzzy/query"; // 报警查询
const luoAnCommonDecode = "/generic/decrypt"; //通用的解密接口
const luoAnCommonGetOpenId = "/goto/wechat/openid"; // 获取openid的
const luoAnDeviceList = "/equipmen/userid/query"; //设备列表
const luoAnUpdateDeviceLocation = "/equipment/update/inputposition"; //更新设备位置
const luoAnUserInfo = "/user/alone/query"; //个人信息
const luoAnUserInfoUpdate = "/user/update"
const luoAnScanDeviceQuery = "/equipment/binding/query"
const luoAnBindAction = "/equipment/binding";//绑定接口
const luoAnDeleteDevice = "/equipment/delete/byid";//删除接口
const LuoAnHttp = {
  /**
   * 微信登录
   */
  asynWXLogin: async (param) => {
    var result = await mrhHttp.asynWXLogin();
    return result.code;
  },

  /**
   * 获取openId 不需要登录
   */
  asyncCommonGetOpenId: async (param, header) => {
    var result = await LMAsyncPostReq({
      ...BaseRequestModel,
      checkUserId:false,
      url: `${baseURL}${luoAnCommonGetOpenId}`,
      param: param
    });
    return result.data;
  },
  /**
   * 通用解密接口
   */
  asyncCommonDecode: async (param, header) => {
    var result = await LMAsyncPostReq({
      ...BaseRequestModel,
      checkUserId:false,
      url: `${baseURL}${luoAnCommonDecode}`,
      param: param
    });
    return result.data;
  },
  /**
   * 同步登录
   */
  asyncLogin: async (param, header) => {
    var result = await LMAsyncPostReq({
      ...BaseRequestModel,
      checkUserId:false,
      url: `${baseURL}${luoAnLogin}`,
      param: param
    });
    return result.data;
  },
  /**
   * 获取userId
   */
  asyncGetUserId: async (param) => {
    const res = await LMAsyncPostReq({
      ...BaseRequestModel,
      checkUserId:false,
      url: `${baseURL}${luoAnGetUserId}`,
      param: param
    });

    return res.data
  },
  /**
   * 获取bannerlist
   */
  asyncGetBannerList: async (param) => {
    const res = await LMAsyncPostReq({
      ...BaseRequestModel,
      checkUserId:false,
      url: `${baseURL}${luoAnBnnerList}`,
      param: param
    });
    return res.data
  },
  /**
   * 获取设备list
   */
  asyncGetDeviceList: async (param) => {
    const res = await LMAsyncPostReq({
      ...BaseRequestModel,
      url: `${baseURL}${luoAnDeviceList}`,
      param: param
    });
    return res.data
  },
  /**
   * 更新位置信息
   */
  asyncUpdateDeviceLocation: async (param) => {
    const res = await LMAsyncPostReq({
      ...BaseRequestModel,
      url: `${baseURL}${luoAnUpdateDeviceLocation}`,
      param: param
    });
    return res.data
  },
  /**
   * 获取报警list
   */
  asyncAlarmQuery: async (param) => {
    const res = await LMAsyncPostReq({
      ...BaseRequestModel,
      url: `${baseURL}${luoAnAlarmQuery}`,
      param: param
    });
    return res.data
  },
  /*
   * 设备轨迹
   */
  asyncDevicePath: async (param) => {
    const res = await LMAsyncPostReq({
      ...BaseRequestModel,
      url: `${baseURL}${luoAnDevicePath}`,
      param: param
    });
    return res.data
  },
  /*
   * 解除警报
   */
  asyncDissmissAlarm: async (param) => {
    const res = await LMAsyncPostReq({
      ...BaseRequestModel,
      url: `${baseURL}${luoAndismissAlarm}`,
      param: param
    });
    return res.data
  },

  /*
   * 解除警报
   */
  asyncUserInfo: async (param) => {
    const res = await LMAsyncPostReq({
      ...BaseRequestModel,
      url: `${baseURL}${luoAnUserInfo}`,
      param: param
    });
    return res.data
  },

   /*
   * 绑定状态查询
   */
  asyncBindStatusQuery: async (param) => {
    const res = await LMAsyncPostReq({
      ...BaseRequestModel,
      url: `${baseURL}${luoAnScanDeviceQuery}`,
      param: param
    });
    return res.data
  },
  asyncBindAction: async (param) => {
    const res = await LMAsyncPostReq({
      ...BaseRequestModel,
      url: `${baseURL}${luoAnBindAction}`,
      param: param
    });
    return res.data
  },

  asyncUserInfoUpdate: async (param) => {
    const res = await LMAsyncPostReq({
      ...BaseRequestModel,
      url: `${baseURL}${luoAnUserInfoUpdate}`,
      param: param
    });
    return res.data
  },

  asyncDeleteDevice: async (param) => {
    const res = await LMAsyncPostReq({
      ...BaseRequestModel,
      url: `${baseURL}${luoAnDeleteDevice}`,
      param: param
    });
    return res.data
  },
  
}





module.exports = LuoAnHttp